;;; GNU Guix --- Functional package management for GNU
;;;
;;; Copyright © 2022 jgart <jgart@dismail.de>
;;;
;;; This file is not part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(define-module (guixrus packages bare)
  #:use-module (guix build-system go)
  #:use-module (guix build-system python)
  #:use-module (guix download)
  #:use-module (guix gexp)
  #:use-module (guix git-download)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (guix packages)
  #:use-module (guix utils)
  #:use-module (gnu packages)
  #:use-module (gnu packages base)
  #:use-module (gnu packages check)
  #:use-module (gnu packages golang)
  #:use-module (gnu packages man)
  #:use-module (gnu packages mail)
  #:use-module (gnu packages video)
  #:use-module ((guixrus packages common go) #:prefix rus:))

(define-public go-git-sr-ht-sircmpwn-go-bare
  (package
    (name "go-git-sr-ht-sircmpwn-go-bare")
    (version "0.0.0-20210406120253-ab86bc2846d9")
    (source (origin
              (method git-fetch)
              (uri (git-reference
                    (url "https://git.sr.ht/~sircmpwn/go-bare")
                    (commit (go-version->git-ref version))))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "0zh36qppk8lscd8mysy0anm2vw5c74c10f4qvhd541wxm06di928"))))
    (build-system go-build-system)
    (arguments
     (list #:import-path "git.sr.ht/~sircmpwn/go-bare"))
    (propagated-inputs (list go-github-com-stretchr-testify
                             rus:go-git-sr-ht--sircmpwn-getopt))
    (home-page "https://git.sr.ht/~sircmpwn/go-bare")
    (synopsis "BARE messages in Go")
    (description "An implementation of the BARE binary message format for Go.")
    (license license:asl2.0)))

(define-public python-pybare
  (package
    (name "python-pybare")
    (version "0.1.1")
    (source (origin
             (method git-fetch)
             (uri (git-reference
                   (url "https://git.sr.ht/~chiefnoah/pybare")
                   (commit (string-append "v" version))))
             (file-name (git-file-name name version))
             (sha256
              (base32
               "1ibmwwf1rdxlwyxlzhv3v1i0ybsqg0kppim90sm8rsbns86yy4by"))))
    (build-system python-build-system)
    (arguments
     (list #:phases
           #~(modify-phases %standard-phases
               (replace 'check
                 (lambda* (#:key tests? #:allow-other-keys)
                   (when tests?
                     (with-directory-excursion "bare"
                       (invoke "pytest" "."))))))))
    (native-inputs (list python-pytest))
    (home-page "https://sr.ht/~chiefnoah/PyBARE/")
    (synopsis "Declarative implementation of BARE for Python")
    (description
"@code{python-pybare} is a general purpose library for strongly
typed primitives in Python that supports serializing to and from BARE
messages.")
    (license license:expat)))
